import "reflect-metadata";

function logMessage<T extends { new (...args: any[]): {} }>(target: T) {
  return class extends target {
    constructor(...args: any[]) {
      console.log(1111);
      super(...args);
    }
    timestamp = Date.now();
  };
}

function logTimestamp(msg: string) {
  return function (target: Function) {
    target.prototype.getObj = function () {
      return { name: "aaaa" };
    };
    console.log(`class ${target.name} initialized timestamp is ${new Date()}`);
  };
}

// @logTimestamp("hello world")
@logMessage
class LogC {
  public tall: string;
  constructor(...args) {
    console.log(args);
    this.tall = "122";
  }
}

let l = new LogC("aa", "bb");

console.log((l as any).timestamp);
